<template>

<div>
 <el-card class="box-card">
 <el-button 

            @click="returns()"
            type="info"
            size="mini"
            style="float:left"
            round
            >返回自学习</el-button>


<el-input v-model="ipadress" style="float:left;width:200px;margin-left:210px" placeholder="请输入ip"></el-input>
<br>
<br
<br>
<br
<br>
<br
<br>
<br
<el-input v-model="port" style="float:left;width:200px;margin-left:300px" placeholder="请输入端口号"></el-input>
<br>
<br
<br>
<br
<br>
<br
<br>
<br
<el-input v-model="adcode" style="float:left;width:200px;margin-left:300px" placeholder="请输入地址码"></el-input>




  <el-select style="margin-left:-600px" v-model="value" filterable placeholder="请选择">
    <el-option
      v-for="item in InnameList"
      :key="item.value"
      :label="item.label"
      :value="item.value">
    </el-option>

  </el-select>


 <el-button 
            @click="online()"
            type="success"
            size="mini"
            style="margin-left: 50px"
            round
            >发送</el-button>
 </el-card>
</div>


</template>

<script>

import studyapi from '@/api/study'

export default {
name:'online',

data() {
      return {
    InnameList:[],
    adcode:'',
    value:'',
    ipadress:'',
    port:''
      }
},
created(){
this.searchInname();
},

methods:{

  returns(){

 this.$router.push({ path:'/'})

  },

searchInname(){
studyapi.searchInname().then(reponse=>{


console.log(reponse.data.data.list)

this.InnameList=reponse.data.data.list
  
})

},

online(){

console.log(this.value)
console.log(this.port)
studyapi.online(this.value,this.adcode,this.ipadress,this.port).then(reponse=>{

console.log(reponse.data.data.data)
if(reponse.data.data.data){
this.$message({
                type: 'success'
                ,
                message:'发送成功'
                })
                return
}

this.$message({
                type: 'error'
                ,
                message:'发送失败'
                })
return
})

}


}

}
</script>

<style>
.box-card {
  width: 100%;
  height: 100%;
}
</style>